<%@ page pageEncoding="UTF-8"%>
<%@ include file = "/common/token.jsp"  %>
<%
	Integer uid = token.getUid();
	Integer id = input.getInt("id", 636);
	List<Notification> list = QBuilder.db("basedb").select().from("Notification").where(new Where("hospital=", hospital).and("id=", id).and("status=", STATUS_ENABLE)).query().getResultObj();
	if (isEmpty(list)) {
		msg.setErrcodeAndErrmsg(30041, "不存在这条通知");
		Tools.encryptPrint(out, msg);
		return;
	}
	Notification n = list.get(0);
	if (n.getConfirmTime() == null) {
		n.setConfirmTime(System.currentTimeMillis());
		n.setConfirmUid(uid);
		DBTools.db("basedb").modItem(n, id);
	}
	List<NotificationConfirm> cList = QBuilder.db("basedb").select().from("NotificationConfirm").where(new Where("hospital=", hospital).and("nid=", id).and("uid=", uid)).query().getResultObj();
	if (isEmpty(cList)) {
		msg.setErrcodeAndErrmsg(30041, "您没有删除确认该通知的权限");
		Tools.encryptPrint(out, msg);
		return;
	}
	NotificationConfirm notificationConfirm = cList.get(0);
	if (notificationConfirm.getStatus().equals(STATUS_DISABLE)) {
		msg.setErrcodeAndErrmsg(30041, "该通知已经被删除");
		Tools.encryptPrint(out, msg);
		return;
	}
	notificationConfirm.setStatus(STATUS_DISABLE);
	DBTools.db("basedb").modItem(notificationConfirm, notificationConfirm.getId());
	Tools.encryptPrint(out, msg);
%>
